<?php
/**
 * 在租家具管理
 * User: tengyu
 * Date: 2017/8/31
 * Time: 13:20
 */?>
@extends('common.common')
@section('title','在租家具-个人中心')
@section('css')<link rel="stylesheet" href="{{asset('/css/personal_furniture.css')}}">@endsection
@section('js')
    <script>
        function choose_rent_status(){
            $('.dropdown-menu li').click(function () {
                var html = $(this).html();
                $('#choose_rent_status').text(html);
                var status = $(this).attr('value');
                search_rent_status(status);//调用筛选方法
            })
        }
        choose_rent_status();
        /**筛选在租家具状态*/
        function search_rent_status(status)
        {
            if(status==''){
                window.location = '/user/rentfitment';
            }else{
                $.ajax({
                    url:'/user/rentfitment/rent_status/'+status,
                    type:'get',
                    dataType:'json',
                    success:function(res){
                        if(res.res=='ok') {
                            window.location = '/user/rentfitment?status=' + status;
                        }
                    }
                });
            }
        }
    </script>
@endsection
@section('content')
    <div id="content">
        @include('common.centernav')
        <h3>个人中心</h3>
        <div class="container">
            <div class="row">
                @include('usercenter.usersidebar')
                <div class="col-xs-9">
                    <div id="panel" class="panel panel-default rightPanel">
                        <div class="panel-heading">
                            <h4 class="myorder">在租家具</h4>
                            <div class="dropdown pull-right">
                                <button id="choose_rent_status" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                    {{$param['rent_status']}}<span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li value="">全部记录</li>
                                    <li value="1">在租记录</li>
                                    <li value="2">报修记录</li>
                                    <li value="3">退租订单</li>
                                </ul>
                            </div>
                        </div>
                        <div class="panel-body">
                            <ul class="product list-inline">
                                <li>商品信息</li>
                                <li>订单金额</li>
                                <li>订单操作</li>
                                <li>时长</li>
                            </ul>
                            @if(count($param['rentlist'])>0)
                            <!--列表组-->
                            @foreach($param['rentlist'] as $k=>$v)
                            <ul class="orders list-inline">
                                <li class="imgInfo">
                                    <div class="media">
                                        <div class="media-left">
                                            <img src="{{asset(env('STATIC_FILE_ERP_PATH').$v->fitment_details_imgOne)}}" style="border-radius:20px;width: 151px;height: 92px;">
                                        </div>
                                        <div class="media-body">
                                            <p>{{$v->details_name}}</p>
                                            <p>
                                                <?php
                                                $color=DB::table('fitment_color')->where('color_details_id',$v->details_id)->select('color_type')->get();
                                                ?>
                                                @foreach($color as $color_k=>$color_v)
                                                    <img src="{{$param['color'][$color_v->color_type]}}" alt="当前家具颜色">
                                                @endforeach
                                            </p>
                                            @if($v->details_rent_type==1)
                                            <p>¥<span>{{$v->details_nimbleprice}}</span>/月</p>
                                            @else
                                            <p>¥<span>{{$v->details_fixprice}}</span>/月</p>
                                            @endif
                                        </div>
                                    </div>
                                </li>
                                @if($v->details_rent_type==1)
                                <li>¥{{$v->details_nimbleprice*$v->details_fitment_number}}</li>
                                @else
                                <li>¥{{$v->details_fixprice*$v->details_fitment_number}}</li>
                                @endif
                                <li class="cancel"><a href="{{url('/user/rentback/'.$v->id)}}">退租</a><p><a href="{{url('/user/rentrepair/'.$v->id)}}">售后</a></p></li>
                                @if($v->details_rent_type==1)
                                <li><span>12</span>个月</li>
                                @else
                                <li><span>18</span>个月</li>
                                @endif
                            </ul>
                            @endforeach
                            <div class="text-right">{{ $param['rentlist']->links() }}</div>
                            <!--列表组-->
                                @else
                                <div class="text-center">
                                    <img src="{{asset('/img/771509094256_.pic.jpg')}}" alt="暂无数据">
                                </div>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="partition"></div>
@endsection
